<!DOCTYPE html>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$serverName = "(local)";
$connectionInfo = array("UID" => "sa", "PWD" => "sa123", "Database"=>"TDKT", "CharacterSet" =>"UTF-8");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn )
{
     echo "Connection established.\n";
}
else
{
     echo "Connection could not be established.\n";
     die( print_r( sqlsrv_errors(), true));
}

//-----------------------------------------------
// Perform operations with connection.
//-----------------------------------------------
//declare the SQL statement that will query the database
$query = "SELECT ID, TEN, NSD ";
$query .= "FROM TD_NSD ";

//execute the SQL query and return records
$result = sqlsrv_query($conn, $query);

$numRows = sqlsrv_num_rows($result); 
echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>"; 

//display the results 
while($row = sqlsrv_fetch_array($result))
{
  echo "<li>" . $row["ID"] ." - ".$row["TEN"] ." - ". $row["NSD"] . "</li>";
}

/* Close the connection. */
sqlsrv_close( $conn);
?>

</body>
</html>